<?php
/**
 * Created by PhpStorm.
 * User: zzz
 * Date: 2019/3/21
 * Time: 1:19
 */
$starttime = explode(' ', microtime());
$ip        = "214.255.253.253";
$n         = 1000000;


$ip = explode(".", $ip);

$num = $ip[0] * 16777216 + $ip[1] * 65536 + $ip[2] * 256 + $ip[3];

$ips = [];
$max = $num + $n;

for ($i = $num; $i < $max; $i++) {
    $d = $i % 256;
    $c = ($i - $d) % 65536 / 256;
    $b = ($i - $d - $c * 256) % 16777216 / 65536;
    $a = ($i - $d - $c * 256 - $b * 65536) / 16777216;
    if ($a > 255) {
        break;
    }
    $ips[] = "$a.$b.$c.$d";
}
$endtime          = explode(' ', microtime());
$thistime         = $endtime[0] + $endtime[1] - ($starttime[0] + $starttime[1]);
$thistime         = round($thistime, 3);
$json['thistime'] = $thistime;
$json["ips"]      = $ips;
echo json_encode($json, JSON_UNESCAPED_UNICODE);